package org.dh2580.dev.tools.util;

import java.util.Objects;

/**
 * 对象工具类
 *
 * @Author: hao.deng
 * @Date: 2018/11/29-上午10:21
 */
public final class NullUtil {
    private NullUtil() {
    }

    public static boolean anyNull(Object... args) {
        Objects.requireNonNull(args, "args cannot be null");
        for (Object arg : args) {
            if (arg == null) {
                return true;
            }
        }
        return false;
    }

    public static boolean nonNull(Object... args) {
        return !anyNull(args);
    }

    public static boolean allNull(Object... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (Object arg : args) {
            if (arg != null) {
                return false;
            }
        }

        return true;
    }
}
